home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_12
/
9n12096a
< prev
next >
Wrap
Text File
|
1991-03-02
|
2KB
|
128 lines
/*
* motif1.c
* Sample Motif program.
*
* Remember xset bc for pane sashes
*
* Written for C Users Journal
*
* 4 March 91
* 28 January 91
* 28 November 90
*/
#include <stdio.h>
/*
* X Toolkit include files
*/
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
/*
* Motif include files
*/
#include <Xm/Xm.h>
#include <Xm/Label.h>
#include <Xm/PanedW.h>
#include <Xm/PushB.h>
void quit_callback( widget, client_data, call_data )
Widget widget;
caddr_t client_data;
caddr_t call_data;
/*
* Callback function to quit program.
* We could close the connection to
* the X server here, or just call exit().
*/
{ /* quit_callback */
exit( 0 );
} /* quit_callback */
main( argc, argv )
int argc;
char *argv[];
{ /* main */
Widget parent;
Arg args[10];
int n;
Widget pane_widget, quit_widget;
Widget label_widget;
XmString motif_string;
parent = XtInitialize( argv[0],
"Motif1", NULL,
0, &argc, argv );
/*
* Create a paned window widget
*/
n = 0;
XtSetArg( args[n], XmNseparatorOn, True ); n++;
XtSetArg( args[n], XmNallowResize, True ); n++;
pane_widget = XtCreateManagedWidget( "pane",
xmPanedWindowWidgetClass,
parent, args, n );
/*
* Create a push button widget
* to quit the program.
*/
n = 0;
quit_widget = XtCreateManagedWidget( "quit",
xmPushButtonWidgetClass,
pane_widget, args, n );
/*
* Set up a callback function
* to be called whenever
* the push button is
* "activated".
*/
XtAddCallback( quit_widget, XmNactivateCallback,
quit_callback, (caddr_t) NULL );
/*
* Set up XmString fot label widget
*/
motif_string = XmStringCreateLtoR( "This is a label",
XmSTRING_DEFAULT_CHARSET );
n = 0;
XtSetArg( args[n], XmNlabelString, motif_string ); n++;
/*
* Create a label widget
*/
label_widget = XtCreateManagedWidget( "label",
xmLabelWidgetClass,
pane_widget, args, n );
XmStringFree( motif_string );
XtRealizeWidget( parent );
XtMainLoop();
} /* main */
/*
* end of file
*/